The invention generally relates to rate control for block-based video encoders, and in particular to methods and systems for performing frame-layer or macroblock-layer rate control in H.264 video encoders.
Various video compression standards have been developed for a wide range of applications such as video telephony, video conferencing, and video streaming. These video coding standards typically involve techniques including discrete cosine transform (DCT), motion estimation (ME) or motion compensation (MC), quantization, and variable length coding (VLC). A quantization parameter (QP), which corresponds to a quantization step-size, can be adaptive during the quantization process and is an important encoding parameter that has a large effect on the quality of resulting encoded video. The quantizer step-size used for a frame or a macroblock (MB) impacts the encoded video quality, and an appropriate rate control algorithm should be utilized to determine the quantizer step-size for a given application and coding environment. That is, the QP value should be continually determined carefully for a given application and video compression standard.
Due to its importance, although not strictly belonging to the scope of standard, rate control has been studied extensively by many researchers. Recently, the H.264 video compression standard has received much attention due to its improved coding efficiency. Accordingly, finding an efficient rate control algorithm for use by H.264 encoders has become an important topic for the practical usage of H.264 with various transmission channels, and several model-based rate control algorithms have been proposed for H.264.
The rate and distortion (R-D) optimized motion estimation and mode decision (also referred to as RDO) with various intra and inter prediction modes and multiple reference frames is a major contributor to the high coding efficiency of H.264 compared with previous video compression standards. However, rate control (RC) of H.264 is complicated due to the inter-dependency between the RDO and RC. That is, RC is utilized to determine a QP value, and the QP value is utilized by the RDO to determine the necessary information for RC. This issue of which parameter to determine first is sometimes referred to as the chicken and egg dilemma and is identified in “Adaptive frame layer rate control for H.264” by Z. G. Li, F. Pan, K. P. Lim, G. N. Feng, S. Rahardja and D. J. Wu, in Proc. IEEE Intl. Conf. Multimedia and Expo, pp. 581-584, June 2003; and “Adaptive rate control for H.264” by Z. G. Li, F. Pan, K. P. Lim, and S. Rahardja, in Proc. IEEE Intl. Conf. Image Processing, pp. 745-748, October 2004.
In both documents mentioned above, the mean absolute difference (MAD) of each basic unit in a current frame is estimated according to the MAD of the collocated basic unit in a previous frame using a linear model. Then, a quadratic rate model is employed to determine the QP of the basic unit, which could be a frame, a slice, or a macroblock (MB). In “A new rate control scheme for H.264 video coding” by P. Yin and J. Boyce, in Proc. IEEE Intl. Conf. Image Processing, pp. 449-452, October 2004, the variance of the residual signal is estimated after performing the RDO with a reduced set of MB partitions and reference frames. The estimated variance is fed into the H.263 TMN8 R-D models described in “Rate control in DCT video coding for low-delay communications,” by J. Ribas-Corbera and S. Lei, IEEE Trans. Circuits and Syst. Video Technol., vol. 9, pp. 172-185, February 1999, to determine the QP values of MBs.
While the estimation methods in many existing algorithms may work for stable video sequences, the accuracy cannot be guaranteed when video sequences contain frames with variable characteristics, for which the rate control performance decreases due to inaccurate estimation of MAD and variance of the residual signal. An improved method of performing frame rate control in H.264 video encoders would be greatly beneficial.